package gui;

import monitor.ControllerStatMonitor;
import stateMachine.StateMachine.Mode;
import states.InitialState;

public class OpcomUpdater extends Thread{
	private ControllerStatMonitor controllerStatMonitor;
	
	
	public OpcomUpdater(ControllerStatMonitor controllerStatMonitor) {
		this.controllerStatMonitor = controllerStatMonitor;
	}

	@Override
	public void run() {
		setPriority(Thread.MAX_PRIORITY-6);
		setName("OpcomThread");
		long t = System.currentTimeMillis();
		long duration = 0;

		

		while(true) {

		controllerStatMonitor.plotData();
			t += 100;
			duration = t-System.currentTimeMillis();
			if ( duration > 0) {
				try {
					sleep(duration);
				} catch(InterruptedException e) {
					e.printStackTrace();
				}
			}

		}
	}
}
		
